package cn.wolfcode.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.wolfcode.domain.ArticleType;
import cn.wolfcode.mapper.ArticleTypeMapper;
import cn.wolfcode.service.IArticleTypeService;

@Service
public class ArticleTypeServiceImpl implements IArticleTypeService{

	@Autowired
	ArticleTypeMapper articleTypeMapper;
	
	@Override
	public List<ArticleType> getArticleTypeList() {
		// TODO Auto-generated method stub
		return articleTypeMapper.getArticleTypeList();
	}

	@Override
	public void save(ArticleType articleType) {
		// TODO Auto-generated method stub
		if(articleType.getId() == null) 
			articleTypeMapper.insert(articleType);
		else 
			articleTypeMapper.updateByPrimaryKey(articleType);
		
	}

	@Override
	public void delete(Long id) {
		// TODO Auto-generated method stub
		articleTypeMapper.deleteByPrimaryKey(id);
	}

	@Override
	public ArticleType getArticleTypeByCode(String articleType) {
		// TODO Auto-generated method stub
		return articleTypeMapper.getArticleTypeByCode(articleType);
	}

}
